package com.craney.testArray
{
	public class TestArray
	{
		public function TestArray()
		{
			var a:Array = ["Craney", "Heather", "Trista", "Oliver", "Herry", "Justin", "Doudou", "dd"]
			trace(a);
			a.sort(Array.CASEINSENSITIVE);
			trace(a);
			
			var b:Array = [1, -23, 545, -456, 657, -78];
			trace("b=" + b);
			var fun:Function = function(a:int, b:int):int
			{
				var va:uint = Math.abs(a);
				var vb:uint = Math.abs(b);
				if(va < vb)
				{
					return -1;
				}
				else if(va > vb)
				{
					return 1;
				}
				else
				{
					return 0;
				}
			};
			
			b.sort(fun);			
			trace(b);
			
			var c:Array = 
			[
				{name:"Craney", score:66, id:0}, {name:"Heather", score:33, id:1}, {name:"Justin", score:33, id:2}, 
				{name:"Yaolice", score:114, id:3}, {name:"Felix", score:33, id:4, "Love":"ss"}
			];
			
			var copy:Array = c.sortOn(["score", "name"], [Array.NUMERIC | Array.DESCENDING | Array.RETURNINDEXEDARRAY, null]);
			
			var num:Array = [1, 3, "as"];
			c[num] = ["hum", 34.5];
			
			trace("========" + c[num]);
			
			print(c);			
			
			trace(a.toString());
		}
		
		private function print(a:Array):void
		{
			for(var i:int; i<a.length; i++)
			{
				trace(a[i]["name"], a[i]["score"], a[i]["id"]);
			}
		}
		

	}
}